feat: add cache-save input for restore-only caching - #140
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
A unit test assertion in src/inputs.test.ts is missing keys that getInputs() returns, which will cause the toEqual check to fail.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a new cache-save input to the GitHub Action to support “restore-only” dependency caching (restore in main phase, optionally skip saving in post phase) while keeping existing workflows working via a default of true.
Changes:
- Introduces
cache-saveinput wiring (Inputs.cacheSave, parsing viagetBooleanInput("cache-save"), andaction.ymldefaulttrue). - Updates post action behavior to save cache only when both
cacheandcache-saveare enabled, with an informational log when skipping. - Updates docs and CI workflow coverage (README + GitHub workflow matrix) and adds/updates unit tests for the new behavior.
File summaries
| File | Description |
|---|---|
| src/types.ts | Adds cacheSave to the Inputs contract. |
| src/inputs.ts | Parses new cache-save input into Inputs.cacheSave. |
| src/index.ts | Gates cache saving in post phase on cacheSave (and exports runPost for testing). |
| src/index.test.ts | Adds targeted tests for runPost cache-save gating behavior. |
| src/inputs.test.ts | Adds coverage for parsing cache-save and updates default-input expectations. |
| src/version-file.test.ts | Updates test fixtures to include cacheSave. |
| src/utils.test.ts | Updates test fixtures to include cacheSave. |
| src/run-install.test.ts | Updates test fixtures to include cacheSave. |
| src/install-viteplus.test.ts | Updates test fixtures to include cacheSave. |
| src/install-sfw.test.ts | Updates test fixtures to include cacheSave. |
| action.yml | Defines the new cache-save input (default true). |
| README.md | Documents cache-save and adds a restore-only usage example + behavior matrix. |
| .github/workflows/test.yml | Expands cache test job to matrix over cache-save true/false. |
| dist/index.mjs | Updates the bundled action to include cacheSave parsing and post-phase gating logic. |
Review details
- Files reviewed: 13/14 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
fengmk2
left a comment
There was a problem hiding this comment.
@naokihaba Good! I love this feature.
Co-authored-by: MK (fengmk2) <fengmk2@gmail.com> Signed-off-by: NaokiHaba <59875779+naokihaba@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
The new cache-save input is consistently implemented across inputs/types/runtime, documented, and covered by unit/CI tests without introducing breaking behavior (default remains saving enabled).
Review details
- Files reviewed: 13/14 changed files
- Comments generated: 0 new
- Review effort level: Lite
resolves #139
This PR adds a
cache-saveinput, defaulting totrueto keep existing workflows working as expected. Whencache-saveis set tofalse, setup-vp restores the cache as usual, but skips saving it at the end. It’s mainly intended for setups where all branches need to read the cache, but only trusted ones should update it.Note that Azure Pipelines and GitLab handle cache behavior through their own platform configs, so this only affects GitHub Actions.